<template>
	<view class="container" :class="'theme-'+theme">
		<view class="mp-search-box themeBgColor">
			<view class="addressBox">
				<view class="iconTableL"  @click="navTo('/pages/address/address')">
					<view class="iconfont icon-addressfill" style="font-size: 20px;color: white;"></view>
					<text class="topText">地址</text>
					</view>
				<view class="search-input">
					<input type="text"
					placeholder="请输入您要搜索的内容"
					v-model="searchValue"
					@click="navToSearch('/pages/search/search')" />
				</view>
				<!-- <view class="searchBox" style="height: 35px;" >
					<view class="inputBox" style="">
						<input class="ser-input"  @click="navToSearch('/pages/search/search')" type="search" placeholder-class="ph" placeholder="搜索" @confirm="toSearch" />
					</view>
				</view> -->
				<view class="iconTableR"  @click="navTo('/pages/message/message')">
					<view class="iconfont icon-message" style="font-size: 18px;color: white;"></view>
					<text class="topText">信息</text>
				</view>
			</view>
			<!-- <view class="searchBox" >
				<view class="inputBox" style="">
					<input class="ser-input"  @click="navToSearch('/pages/search/search')" type="search" placeholder-class="ph" placeholder="搜索" @confirm="toSearch" />
				</view>
			</view> -->
		</view>
		<view class="head-section" >
			<!-- <image src="../../static/bg.png" class="bg" /> -->

		</view>
		<!-- 头部轮播 -->
		<view v-if="swiperLength > 0" class="carousel-section" :style="{top:(top+50)+'px'}">
			<swiper indicator-dots autoplay class="carousel" circular @change="swiperChange">
				<swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item">
					<image  :src="item.h5ImgUrl" @error="item.h5ImgUrl = errorImgUrl" />
				</swiper-item>
			</swiper>
		</view>

		<!-- 公告 -->
		<view class="articles" v-if="noticeList.length > 0">
			<image :src="articleImg"></image>
			<swiper @change="swiperChagne" autoplay vertical circular class="article-swiper">
				<swiper-item class="article-swiper-item" v-for="(item,index) in noticeList" :key="index"
					@click="goNoticeDetail(item)">
					【{{item.colunmsName}}】{{item.title}}
				</swiper-item>
			</swiper>
			<view class="split"></view>

			<view @click="navTo('/pages/message/inform')">更多</view>
		</view>
		<!-- 心愿单-->
		<!-- <view class="articles" v-if="wishDataList.length > 0">
			<image :src="articleImg"></image>
			<swiper @change="swiperChagne" autoplay vertical circular class="article-swiper">
				<swiper-item class="article-swiper-item" v-for="(item,index) in wishDataList" :key="index"
					@click="goToWishDetail(item)">
					【心愿单】{{item.name}}发起了一条{{item.title}}的心愿单
				</swiper-item>
			</swiper>
			<view class="split"></view>
			<view @click="navTo('/pages/wishList/wishList')">更多</view>
		</view> -->

		<!-- 一级品目 -->
		<view class="hot-c" v-if="hotCatalogList.length>0">
			<swiper class="hot-swiper" circular>
				<swiper-item class="hot-swiper-list" v-for="(s,i) in hotTimes" :key="i">
					<view @click="toCatalog(item)" class="hot-swiper-item" v-for="(item,index) in hotCatalogList.slice(i*8,i*8+8)"
					 :key="index">
						<image  :src="item.h5Icon?item.h5Icon:'../../static/error-img-115.png'" mode="aspectFill"></image>
						<view class="catalog-name more-t">{{item.name}}</view>
					</view>
				</swiper-item>
			</swiper>
		</view>

		<!-- 热门供应商 -->
				<view class="hot-supplier" v-if="isZtsj">
					<view class="hot-supplier_header">
					<text>热门供应商</text>
					<text @click="$u.route('pages/hotList/hotList')">更多</text>
					</view>
					<scroll-view scroll-x v-if="storeList.length>0">
						<view class="hot-supplier_wrapper">
							<view @click="jumpstore(history)" v-for="(history,index) in storeList" class="history_item" style="margin-right: 10upx;"
								>
								<view class="hot-supplier_item_img">
									<image :src="history.h5LogoUrl" mode="aspectFill"></image>
								</view>
								<view class="hot-supplier_item_content">
									{{history.supplierName}}

								</view>
							</view>
						</view>
					</scroll-view>
					<u-empty v-else text="暂无数据"></u-empty>
				</view>
		<!-- 热销商品-->
		<view class="seckill-section m-t" v-if="hotGoodsList.length>0">
			<view class="order-hotTitle" >
				<view class="hot-title" >
					<image src="../../static/newh5/hot-item.png" class="yticon"
						style="width: 90px;height: 20px;" mode="aspectFill"></image>
				</view>
				<view  style="display: flex;align-items: center;">
					<text style="color: grey;font-size: 12px;">好货超值抢</text>
					<text class="eticon eticon-youjiantou themeTextColor"></text>
					<!-- <view class="hot-title-image"></view> -->
<!-- 					<image src="../../static/newh5/Arrow-Right.png" class="yticon"
						style="width: 15px;height: 15px;" mode="aspectFill"></image> -->
				</view>
			</view>
			<scroll-view class="hot-list" scroll-x>
				<view class="scoll-wrapper">
					<view v-for="(item, index) in hotGoodsList" :key="index" class="hot-item" @click="navToDetailPage(item)">
						<image
						style="border: 1px solid #e2e2e2;"
						:src="item.thumbnail!==''?item.thumbnail:item.goodsImageList[0].url===''? errorImgUrl:item.goodsImageList[0].url"
						mode="aspectFill" @error="item.thumbnail = errorImgUrl"></image>
							<!-- {{item.goodsName}} -->
							<text class="item-title more-t" >{{item.goodsName}}</text>
						<view v-if="hasLogin||isShowPriceUnlogin==1" style="display:flex;" class="goodPriceBox" @click.stop="addCart(item)">
							<view class="priceBox" style="display: flex;align-items: center;">
								<text class="price" style="text-align: left;padding-left: 8rpx;">￥{{ item.goodsPrice|twoBitMoney }}</text>
							</view>
							<view class="buyBox">
								<text class="price">抢</text>
							</view>
							<!-- <image class="cartIcon" src="../../static/cart.png" @click.stop="addCart(item)"></image> -->
						</view>
						<view v-else class="price" style="color: #fa436a;">登录查看</view>
					</view>
				</view>
			</scroll-view>
		</view>

		<!-- 品牌优选 & 新品首发 -->
		<view class="hotNew-seciton" v-if="isZtsj">
			<view class="hotNew_item" @click="$u.route('pages/product/groupFavor')">
				<view class="hotNew_item_text">
					<view class="hotNew_item_text_h">热门品牌</view>
					<view class="">精选优质品牌</view>
				</view>
				<image src="../../static/index/hot.png" mode="widthFix"></image>
			</view>
			<view class="hotNew_item" @click="$u.route('pages/product/newList')">
				<view class="hotNew_item_text">
					<view class="hotNew_item_text_h">新品首发</view>
					<view class="">精选优质新品</view>
				</view>
				<image src="../../static/index/new.png" mode="widthFix"></image>
			</view>
		</view>
		<!-- 品牌优选 & 新品首发 -->

		<!-- 广告位 -->
		<swiper indicator-dots autoplay class="advertise-carousel" circular>
			<swiper-item v-for="(item, index) in homeBannerList" :key="index" class="carousel-item" @click="onAdvertiseClick(item)">
				<image :src="item.h5ImgUrl" @error="item.h5ImgUrl = errorImgUrl"/>
			</swiper-item>
		</swiper>
		<!-- 广告位 -->

		<!-- 专区 -->
		<sepcial-section class="MT15" v-if="specialList.length>0" :specialList="specialList" :hasLogin="hasLogin" @detail="navToFloorItemDetail" @add="addCart"></sepcial-section>
		<!-- 专区 -->
		<!-- 楼层 -->
		<view class="floor-section" v-if="floorList.length>0">
			<view class="floor-content">

					<view class="nav" style="background-color: white;">
						<view v-for="(navItem,nIndex) in floorNameList"
						 :key="nIndex" @click="navClick(nIndex)"
						 class="nav-item" :class="{current: navIndex === nIndex}">{{ navItem.name }}
						</view>
					</view>
					<view class="tab" style="background-color: white;margin-top: 2px;">
						<view v-for="(item,index) in floorList[navIndex].floorGoodsList" :key="index" class="tab-item" :class="{current: floorList[navIndex].curIndex === index}"
						 @click="tabClick(index,item)">
							{{ item.goodsCatalogsName }}
						</view>
					</view>


				<view class="item-area">

					<!-- 商品楼层 -->

					<view class="item-wrapper" v-if="floorList[navIndex].floorGoodsList[floorList[navIndex].curIndex]">
						<u-empty style="height: 269px;background-color: #fafafa;" icon-size="160" v-if="floorList[navIndex].floorGoodsList[floorList[navIndex].curIndex].productData.length === 0"
						 class="empty-container" mode="list" text=”暂无数据“></u-empty>
						<view class="floor-item" v-else v-for="(good,goodIndex) in floorList[navIndex].floorGoodsList[floorList[navIndex].curIndex].productData"
						 :key="goodIndex" @click="navToFloorItemDetail(good)">
							<image :src="good.goodsImage===''?errorImgUrl:good.goodsImage" mode="aspectFill" @error="good.goodsImage = errorImgUrl"></image>
							<text class="item-title more-t">{{ good.goodsName }}</text>
							<view class="bottom">
								<view class="left">
									<view v-if="hasLogin">
										<text class="price">￥{{ good.goodsPrice|twoBitMoney }}</text>
									</view>
									<view v-else class="price" style="color: #fa436a;">登录查看</view>
								</view>
								<view class="right">
									<image src="../../static/newh5/cart.png" @click.stop="addCart(good)"></image>
								</view>
							</view>
							<view style="display: flex;flex-wrap: wrap;" v-if="good.activity&&good.activity.type">
								<template v-if="good.activity.type===1">
									<view class="tag" v-for="(rule, ruleIndex) in good.activity.ruleList" :key="rule.id">
										{{rule.num}}件{{rule.discount}}折
									</view>
								</template>
							</view>
						</view>
					</view>


				</view>
			</view>
		</view>
		<!-- 楼层 -->
		<!-- 回到顶部 按钮 -->
		<view class="backIcon" >
			<back-top  style="right: 34rpx;bottom: 200rpx;width: 80rpx;height: 80rpx;" :scrollTop='scrollTop' src='../../static/newh5/top.png'></back-top>
		</view>
	<!-- 	<view @click="navTo('/pages/set/feedBack')" class="drag-button">
			<image src="../../static/Feedback.png" @error="item.h5ImgUrl = errorImgUrl" />
		</view> -->
		<!-- 开屏广告 -->
		<u-mask v-if="showBanner" :show="showBanner" :style="{'z-index':99999}" :zoom="false" :mask-click-able="false">
			<view class="home-banner" :class="{show:showBannerView}">
				<image :src="homeBannerData.h5ImgUrl" mode="aspectFill"/>
				<view class="home-banner-btn skip" @click="skip">跳过</view>
				<view class="home-banner-btn detail" v-if="homeBannerData.h5OpenUrl" @click="toBannerDetail">
					点击跳转详情页面<u-icon name="arrow-right" color="#fff"></u-icon>
				</view>
			</view>
		</u-mask>
		<!-- 开屏须知 -->
		<u-modal v-model="showHomeNotice" title="系统公告" :confirm-style="{'font-size':'26rpx'}" confirm-color="#300313" :confirm-text="computedNoticeText+'关闭'" @confirm="closeHomeNotice">
			<view class="home-notice">
				<view class="home-notice-title">{{homeNoticeData.title}}</view>
				<view class="home-notice-content" v-html="homeNoticeData.content"></view>
			</view>
		</u-modal>
		<!-- 在线客服 -->
		<online-service v-if="isShowCustomerService" is-platform></online-service>
	</view>
</template>

<script>
	import OnlineService from '../../components/online-service/online-service.vue'
	import backTop from '@/components/back-top/back-top.vue';
	import {
		errorImgUrl
	} from '@/common/utils/config.js';
	import {
		getSupplierList
	} from '../../api/hotStores/hotStores.js'
	import {
		category
	} from '@/api/category/category.js'
	// import {
	// 	getWaitCount,
	// 	queryDefinedHotGood
	// } from '@/api/index/index.js'
	import {
    getWishList,
    enterWishList
} from '../../api/wish/wish'
	import {
		getCarouselList,
		getQueryHotGoods,
		getFloorInfoWithGoods,
		getFloorInfo,
		getFloorGoods,
		getFloorGoodsForNew,
		getWaitCount,
		queryDefinedHotGood,
		countUndoWork,
		countCart,
		getNoticeList,
		homePageBanner,
		homeNotice,
		queryAdversting,
		getWelfareInfo
	} from '@/api/index/index';
	import {
		addToCart
	} from '../../api/cart/cart.js'
	import {
		mapState
	} from 'vuex';
	import {
		getHotCatalogs
	} from "../../api/index";
	import {qryConfByItemCode} from '@/api/user/user.js'
	import {queryGoodsLowestPriceById} from '@/api/order/order.js'
	import {
		jugdeShopSetting
	} from '../../api/hotStores/hotStores.js'
	let goodsTypeList = [];
	let floorGoodsIdList = [];
	export default {
		components: {
			backTop,
			OnlineService
		},
		data() {
			return {
				wishDataList:[],
				scrollTop:0,
				searchValue:'',
				//要跳转的一级目录
				jumpCatalogIds:[],
				activeItemStyle: {
					height: '20px',
					lineHeight: '20px',
					backgroundColor: '#FF7948',
					color: '#fff',
					fontWeight: 'unset',
					borderRadius: '20px',

					// padding: '1px 6px'
				},
				hotCatalogList: [],
				allCatalogs: [],
				hotTimes: [],
				titleNViewBackground: '',
				swiperCurrent: 0,
				swiperLength: 0,
				carouselList: [],
				noticeList: [],
				hotGoodsList: [],
				isShowPriceUnlogin: uni.getStorageSync('isShowPriceUnlogin')||0,
				errorImgUrl: errorImgUrl,
				floorList: [],
				floorNameList: [],
				catalogGoodsMap: {},
				catalogIdList: [],
				floorCatalogIndexList: [],
				searchKey: '',
				navIndex: 0,
				tabIndex: 0,
				refresh: false,
				top: 0,
				// 广州银行-校验商品最低价
				isbuyMinPrice:false,
				// 开屏广告
				showBanner:false,
				showBannerView:false,
				// 开屏广告内容
				homeBannerData:{},
				// 广告位
				homeBannerList:[],
				// 开屏须知
				showHomeNotice:false,
				homeNoticeData:{},
				homeNoticeInterval:null,
				noticeTime:-1,
				storeList:[],
				// 专区
				specialList: [],
				// 是否显示客服
				isShowCustomerService: 0,
        isZtsj: false,
			};
		},
		onPageScroll(res){
			// console.log(res.scrollTop);//距离页面顶部距离
			this.scrollTop = res.scrollTop

		},
		onLoad(option) {
			// this.showMsg(option);
			// 初始化是否显示客服
			this.isShowCustomerService = uni.getStorageSync('isShowCustomerService')
			    ? Number(uni.getStorageSync('isShowCustomerService')) : 1
			this.toBacklog();
						// 热门供应商
						this.loadSupplierList()
			if (this.hasLogin) {
				countUndoWork().then(res => {
					if (res.data > 0) {
						uni.setTabBarBadge({
							index: 3,
							text: res.data.toString()
						})
					} else {
						uni.removeTabBarBadge({
							index: 3
						})
					}
				})
				this.getCart();
				this.getConf()

				// 开屏须知
				this.loadHomeNotice()
			}else{
				uni.removeTabBarBadge({
					index: 3
				})
				uni.removeTabBarBadge({
					index: 2
				})
				// 开屏广告
				this.loadHomeBanner()
			}
			this.top = uni.getSystemInfoSync().statusBarHeight
			this.loadData();
			this.loadFloorInfo();
			this.loadHotCatalogs();
			//心愿单
			// this.getWishDataList()
			this.getNotice()
			// 广告位
			this.loadBannerList()
			// 专区
			this.getSpecialList()
		},
		onShow() {
			uni.setStorageSync('procurementPlan', {})

			if (this.hasLogin) {
				countUndoWork().then(res => {
					if (res.data > 0) {
						uni.setTabBarBadge({
							index: 3,
							text: res.data.toString()
						})
					} else {
						uni.removeTabBarBadge({
							index: 3
						})
					}
				})
				this.getCart();
			}else{
				uni.removeTabBarBadge({
					index: 3
				})
				uni.removeTabBarBadge({
					index: 2
				})
			}
		},
		onPullDownRefresh() {
			this.refresh = true;
			this.loadData();
			this.loadHotCatalogs();
			this.loadFloorInfo();

		},
		computed: {
			...mapState(['hasLogin']),
			articleImg(){
				return require(`../../static/${this.theme}/notice.svg`)
			},
			computedNoticeText(){
				if(this.noticeTime>0){
					return this.noticeTime+'s后可'
				}else {
					return ''
				}
			}
		},
		methods: {
			getWishDataList(){
				const param = {
					page: 1,
					limit: 499,
					status:'2,3,7'
					// pageType: 1,
            	};
				getWishList(param).then((res) => {
					console.log('res',res);
					if (res.code === 0) {
						this.wishDataList = res.data.records
					}else{

					}
				})
			},
			// 专区  活动
			getSpecialList() {
				getWelfareInfo().then(res => {
					if (res.code === 0) {
						if (res.data.length > 0) {
							const welfareList = res.data||[]
							this.specialList = welfareList.filter(i=>i.type===2)
						}
					}
				})
			},
			// 开屏广告  未登录 到首页都展示开屏广告
			loadHomeBanner(){
				queryAdversting({type:3}).then(res=>{
					if(res.code===0){
						const data = res.data
						if(data&&data.id){
							this.showBanner = true
							this.showBannerView = true
							this.homeBannerData = data
						}
					}
				})
			},
			skip(){
				this.showBanner=false
				setTimeout(()=>{
					this.showBannerView = false
				},300)
			},
			toBannerDetail(){
				if(!this.homeBannerData.h5OpenUrl) return
				if (this.homeBannerData.h5UrlType == "1") {
					uni.navigateTo({
						url:this.homeBannerData.h5OpenUrl
					})
				} else {
				    window.location.href = this.homeBannerData.h5OpenUrl;
				}
			},
			// 开屏须知
			loadHomeNotice(){
				const hasShowNotice = uni.getStorageSync('hasShowNotice')
				queryAdversting({type:2}).then(res=>{
					if(res&&res.code===0&&res.data&&res.data.id&&!hasShowNotice){
						this.homeNoticeData = res.data
						this.showHomeNotice = true
						if(this.homeNoticeData.isCompulsoryReading=='1'){
							// 强制阅读
							const that = this
							this.noticeTime = 5
							this.homeNoticeInterval = setInterval(()=>{
								if(!that.showBanner){
									that.noticeTime -= 1
								}
								if(that.noticeTime<1){
									that.clearNoticeInterval()
								}
							},1000)
						}
						uni.setStorageSync('hasShowNotice',true)
					}
				})
			},
			closeHomeNotice(){
				if(this.noticeTime>0){
					this.showHomeNotice=true
					return
				}
				this.showHomeNotice = false
			},
			clearNoticeInterval(){
				clearInterval(this.homeNoticeInterval)
			},
			// 广告位
			loadBannerList(){
				homePageBanner().then(res=>{
					if(res.code===0){
						this.homeBannerList = res.data||[]
					}
				})
			},
			// 广告点击
			onAdvertiseClick(item){
				if(!item.h5OpenUrl) {
					return false
				}
				if(item.h5UrlType == '1') {
					uni.navigateTo({
						url:item.h5OpenUrl
					})
				}else {
				    window.location.href = item.h5OpenUrl
				}
			},
			jumpstore(item) {
				jugdeShopSetting({
					code: item.supplierCode
				}).then(res => {
					if (res.code == 0) {
						if (JSON.stringify(res.data) != '{}') {
							uni.navigateTo({
								url: `/pages/hotList/hotStore?id=${res.data.supplierId}`
							})
						} else {
							this.$util.msg('该供应商无店铺')
						}
					}
				})

			},
			loadSupplierList() {
				getSupplierList().then(res => {
					if(res.code == 0) {
						this.storeList = res.data
						console.log(this.storeList)
					}
				})
			},
			getConf(){
				const deptInfo = uni.getStorageSync('deptinfo')[0]
				qryConfByItemCode({code: "isbuyMinPrice",
					tenant_id: deptInfo.tenantId,
					dept_code: deptInfo.deptCode}).then(res=>{
						if(res.code===0){
							this.isbuyMinPrice = res.data.val == '1'
						}
				})
			},
			getNotice(){
				const deptinfo = uni.getStorageSync('deptinfo')[0]
				getNoticeList({page: 1,
				limit: 5,
				colunmsId: 0,
				isLoginShow: false,
				deptCode: deptinfo.deptCode,
				deptId: deptinfo.deptId}).then(res=>{
					console.log(res)
					if(res.code===0){
						this.noticeList = res.data
					}
				})
			},
			// 公告切换
			swiperChagne(val) {
				const index = val.detail.current;
			},
			goToWishDetail(item){
				console.log('item',item);
				if (!this.hasLogin) {
					uni.showModal({
						title: '提示',
						content: '您还未登录，不能进行此操作',
						confirmText: '去登录',
						cancelText: '取消',
						success: (suc) => {
							if (suc.confirm) {
								uni.navigateTo({
									url: '/pages/public/login'
								})
							}
						}
					})
				} else {
					uni.navigateTo({
						url: `/pages/wishList/wishContent?id=${item.id}`
					})
				}
			},
			// 公告详情
			goNoticeDetail(item) {
				if (!this.hasLogin) {
					uni.showModal({
						title: '提示',
						content: '您还未登录，不能进行此操作',
						confirmText: '去登录',
						cancelText: '取消',
						success: (suc) => {
							if (suc.confirm) {
								uni.navigateTo({
									url: '/pages/public/login'
								})
							}
						}
					})
				} else {
					if(item.colunmsName == '采购公告') {
						uni.navigateTo({
							url: `/pages/message/informPurchaseDetail?id=${item.id}&articleType=${item.articleType}`
						})
					}else if(item.colunmsName == '心愿单'){
						url: `/pages/wishList/wishList`
					}else {
						uni.navigateTo({
							url: `/pages/message/informDetail?id=${item.id}&articleType=${item.articleType}`
						})
					}

				}
			},
			backToTop(){
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			navToSearch(url){
				uni.navigateTo({
					url
				})
			},
			//地址跳转
			navTo(url) {
				uni.navigateTo({
					url
				})
				// if (!this.hasLogin) {
				// 	uni.showModal({
				// 		title: '提示',
				// 		content: '您还未登录，不能进行此操作',
				// 		confirmText: '去登录',
				// 		cancelText: '取消',
				// 		success: (suc) => {
				// 			if (suc.confirm) {
				// 				uni.navigateTo({
				// 					url: '/pages/public/login'
				// 				})
				// 			}
				// 		}
				// 	})
				// } else {
				// 	uni.navigateTo({
				// 		url
				// 	})
				// }
			},
			loadWxmpInfo (option) {
				const wxLoginToken = option.token;
				if (wxLoginToken) {
					// 获取到token，登录成功
					this.$store.dispatch('wxIndexLoad', wxLoginToken).then(res => {
						if (res.code === 0) {
							this.$util.msg("登录成功");
							const applyId = option.applyId;
							if (applyId) {
								// 获取到applyId，从待办事项进入，重定向到相应页面
								const isDone = option.status == 'A' ? '0' : '';
								const bizType = option.bizType;
								let route = 'backlog-detail';
								if (bizType == 'integral') {
									route = 'backlogWalfareDetail';
								}
								uni.navigateTo({
									url:
										`/pages/backlog/` + route +`?applyId=` + option.applyId
										+ `&procInstId=` + option.procInstId
										+ `&actInstId=` + option.actInstId
										+ `&isDone=` + isDone
								})
							}
						} else {
							this.$util.msg(res.message);
						}
					});
				} else if(option.applyId) {
					// 未获取到token，但获取到applyId，即从待办事项进入且当前微信未绑定账号
					uni.setStorageSync('workInfo', option);
				}else if (option.errMsg) {
					this.$util.msg(option.errMsg);
				}
				if (msgCode === "60002") {
					this.$util.msg("此用户代码不存在或已注销！");
				} else if (msgCode === "60000") {
					this.$util.msg("此用户已被停用，无法登录！");
				} else if (msgCode === "60001") {
					this.$util.msg("此用户被锁定");
				} else if (msgCode === "0") {
					this.$util.msg("登录成功");
				} else {
					this.$util.msg(msgCode);
				}
			},
			toBacklog() {
				const option = uni.getStorageSync("backlogOption", option);
				if (!option){
					return;
				}
				// 移除缓存
				uni.removeStorageSync("backlogOption", option);
				// 获取到applyId，从待办事项进入，重定向到相应页面
				const isDone = option.status == "A" ? "0" : "";
				const bizType = option.bizType;
				let route = "backlog-detail";
				if (bizType == "integral") {
					route = "backlogWalfareDetail";
				}
				uni.navigateTo({
					url: `/pages/backlog/${route}?applyId=${option.applyId}&procInstId=${option.procInstId}&workitemId=${option.workitemId}&actInstId=${option.actInstId}&entityId=${option.entityId}&isDone=${isDone}`,
				});
			},
			getCart() {
				countCart().then(res => {
					console.log(res)
					if (res > 0) {
						uni.setTabBarBadge({
							index: 2,
							text: res.toString()
						})
					} else {
						uni.removeTabBarBadge({
							index: 2
						})
					}
				})
			},
			async loadData() {
				getCarouselList({
					position: "2"
				}).then(res => {
					if (res.code === 0) {
						// 没设置h5轮播图片的不展示
						this.carouselList = [];
						res.data.forEach(carousel => {
							if (carousel.h5ImgUrl){
								this.carouselList.push(carousel);
							}
						});
						// this.carouselList = res.data;
						this.swiperLength = this.carouselList.length;
					}
				})
				var hotGoods = "1";
				if(uni.getStorageSync('portalSettingsInfo').hotGoods){
					hotGoods = uni.getStorageSync('portalSettingsInfo').hotGoods;
				}
				var hotGoodsArray = [];
				var res = {};
				// if(!this.hasLogin) return
				// if (hotGoods == "1"){
				// 	res = await getQueryHotGoods()
				// } else {
				res = await queryDefinedHotGood()
				// }
				if (res.code !== 0){
					return;
				}
				hotGoodsArray = res.data;
				hotGoodsArray.forEach(goods => {
					if(!goods.goodsPrice){
						goods.goodsPrice = goods.price;
					}
					// if(!goods.goodsImageList||goods.goodsImageList.length===0){
					// 	let img = {
					// 		url:"",
					// 		smallUrl:""
					// 	}
					// 	goods.goodsImageList = [];
					// 	goods.goodsImageList.push(img);
					// }
					if(!goods.thumbnail){
						goods.thumbnail = goods.goodsImageList[0].url
					}
				});
				this.hotGoodsList = hotGoodsArray;
				// console.log('热销商品',this.hotGoodsList)
			},
			loadHotCatalogs() {
				// category
				// getHotCatalogs().then(res => {
				category().then(res => {
					if (res.code == 0) {
						var catalogs = res.data;
						var level1Catalogs = [];
						var maxDepth = 3;
						var i = 3;
						while(i>0){
							catalogs.forEach(c1 => {
								if (c1.treeDepth == i){
									catalogs.forEach(c2 => {
										if (c2.id == c1.parentId){
											if (c2.children){
												c2.children.push(c1)
											} else {
												c2.children = [];
												c2.children.push(c1)
											}
										}
									})
								}
							});
							--i;
						}
						//树递归一级菜单
						level1Catalogs = this.toTree(catalogs)
						// catalogs.forEach(catalog => {
						// 	if (catalog.treeDepth == 0) {
						// 		level1Catalogs.push(catalog);
						// 	}
						// });
						// return
						this.hotCatalogList = level1Catalogs;
						console.log('首页一级菜单',this.hotCatalogList);
						if (this.hotCatalogList.length > 0) {
							const times = Math.ceil(this.hotCatalogList.length / 8)
							for (var i = 0; i < times; i++) {
								this.hotTimes[i] = i
							}
						}

					} else {
						this.$util.msg(res.message)
					}
				})
			},
			//树结构处理
		    toTree(data) {
		          // 删除 所有 children,以防止多次调用
		        data.forEach(function (item) {
		          delete item.children;
		        });
		        // 将数据存储为 以 id 为 KEY 的 map 索引数据列
		        var map = {};
		        data.forEach(function (item) {
		          map[item.id] = item;
		        });
		        //console.log(map);
		        var val = [];
		        data.forEach(function (item) {
		          // 以当前遍历项，的parentId,去map对象中找到索引的id
		          var parent = map[item.parentId];
		          if (parent) {
		            (parent.children || ( parent.children = [] )).push(item);
		          } else {
		            val.push(item);
		          }
		        });
		        return val;
		      },
			toCatalog(item) {
				this.jumpCatalogIds = [];
				// console.log(item);
				this.getCatalogIds(item);
				console.log('p品目内容',item)
				let id = item.id
				// console.log(this.jumpCatalogIds.join(','));
				// 传输品目Id
				getApp().globalData.categoryIds = this.jumpCatalogIds.join(',');
					// url: `/pages/product/list?fid=${this.currentId}&sid=${sid}&tid=${tid}`
				uni.reLaunch({
					url: `/pages/category/category?firstId=${id}`
				})
				// uni.navigateTo({
				// 	url: `/pages/category/category`
				// })
			},
			// 获取品目的子集下所有id
			getCatalogIds(item){
				this.jumpCatalogIds.push(item.id);
				if (item.children){
					item.children.forEach(child => {
						this.getCatalogIds(child)
					});
				}
			},
			addCart(item,isMin = false) {
				if (!this.hasLogin) {
					uni.showModal({
						title: '提示',
						content: '您还未登录，不能进行此操作',
						confirmText: '去登录',
						cancelText: '取消',
						success: (suc) => {
							if (suc.confirm) {
								uni.navigateTo({
									url: '/pages/public/login'
								})
							}
						}
					})
				} else {
					if(this.isbuyMinPrice&&!isMin){
						this.queryLowestPriceGoods(item)
						return
					}
					let pType;
					let qType;
					if (item.goodsSourceType === 0) {
						pType = '02';
						qType = 1;
					} else {
						pType = '01';
						qType = 2;
					}
					var areaId = uni.getStorageSync('areaId')?uni.getStorageSync('areaId'):uni.getStorageSync('enterpriseInfo').areaId;
					let params = {
						num: 1,
						goodsId: item.goodsId,
						areaId: areaId
					};
					addToCart(params).then(res => {
						console.log(params)
						if (res.code === 0) {
							this.$util.msg('加入购物车成功')
							this.getCart();
						} else if(res.code === 1001) {
						let msg = ''
						if(res.extra.productAvailability) {
							msg = res.extra.productAvailability.filter(item => !item.canPurchase).map(item => item.message).toString()
						}
						this.$util.msg(res.message+' '+msg)
					}else {
							this.$util.msg(res.message)
						}
					})
				}
			},
			queryLowestPriceGoods(item){
				queryGoodsLowestPriceById({goodsId: item.goodsId,purchaserId: uni.getStorageSync('deptinfo')[0].deptId}).then(response=>{
					if(response.code === 0){
					  let res = response.data;
					  if(res.goodsId) {
						  // 返回商品
						  let lowestPrice = Number(res.goodsPrice)
						  if (lowestPrice < item.goodsPrice){
							//不是最低价商品，需要跳转到新商品
							uni.showModal({
								title:'温馨提示',
								content:'商城存在价格更低的同类商品',
								confirmText:'前往购买',
								showCancel:false,
								success(suc) {
									if(suc.confirm){
										uni.navigateTo({
											url:`/pages/product/product?id=${res.goodsId}`
										})
									}
								}
							})
						  } else {
							this.addCart(item,true)
						  }
					  } else {
						this.addCart(item,true)
					  }
					}else{
						this.addCart(item,true)
					}
				})
			},
			loadFloorInfo() {
				let params = {
					dept_id: uni.getStorageSync('deptinfo')[0].deptId,
					tenant_id: uni.getStorageSync('deptinfo')[0].tenantId,
					fillType: 1,
					limit: 8
				}
				getFloorInfoWithGoods({specialAreaId: 2}).then(res => {
					if (res.code === 0) {
						this.floorList = res.data;
						this.floorList.forEach(floor => {
							let flag = false;
							let floorGoodsList = floor.floorGoodsList;
							this.$set(floor, "curIndex", 0);
							floorGoodsList.forEach(good => {
								if (good.goodsCatalogs !== '') {
									flag = true;
									this.catalogIdList.push(good.goodsCatalogs);
									this.floorCatalogIndexList.push(0);
									goodsTypeList.push(good.goodsType)
									floorGoodsIdList.push(good.id)
								}
							});
							if (!flag) {
								floorGoodsIdList.push("100_100");
								goodsTypeList.push(1);
								this.catalogIdList.push(
									this.floorList[index].goodsCatalogs
								);
							}
						});
						this.floorList.forEach(floor => {
							this.floorNameList.push({
								name: floor.name
							})
						});
					}
				})

			},
			loadFloorGoods(floorId, floorGoodsId) {
				let catalogIds = null;
				let goodsType = null;
				// let floorGoodsId = null;
				if (this.catalogIdList.length > 0) {
					catalogIds = this.catalogIdList.join(',');
					goodsType = goodsTypeList.join(",");
					// floorGoodsId = floorGoodsIdList.join(",");
				}
				const params = {
					sortType: 1,
					page: 1,
					limit: 8,
					floor_id: floorId,
					catalogIds: catalogIds,
					goodsType: goodsType,
					floor_goods_id: floorGoodsId,
					isStandard: -1, //是否标准商品 0-非标品 1-标准商品  -1-全部商品
				}
				getFloorGoodsForNew(params).then(res => {
					if (res.code === 0) {
						this.catalogGoodsMap = {};
						this.catalogGoodsMap = res.data;
						let list = this.floorList;
						this.floorList = []
						list.forEach(item => {
							let flag = false;
							for (let i = 0; i < item.floorGoodsList.length; i++) {
								// let products = [];
								// item.floorGoodsList[i].productData = this.catalogGoodsMap[item.floorGoodsList[i].goodsCatalogs].filter(product => product.goodsPrice !== '')
								if (item.floorGoodsList[i].productData.length > 0) {
									flag = true
								}
								if (item.floorGoodsList[i].productData.length === 0) {
									item.floorGoodsList.splice(i, 1)
									i--;
								}
							}
							if (flag) {
								this.floorNameList.push({
									name: item.name
								})
								this.floorList.push(item)
							}
							// this.floorList[navIndex].floorGoodsList[floorList[navIndex].curIndex].productData
						})
						if (this.refresh) {
							uni.stopPullDownRefresh()
						}
					} else {
						this.toast(res.message)
					}
				})
			},
			navClick(index) {
				this.navIndex = index;
			},
			tabClick(tabIndex, item) {
				// this.tabIndex = tabIndex
				this.floorList[this.navIndex].curIndex = tabIndex;
				const params = {
					fillType: "1",
					limit: 8,
					floor_goods_id: item.id,
					floor_id: this.floorList[this.navIndex].id,
					page: 1
				}
				// console.log(params);
				getFloorGoodsForNew(params).then(res => {
					if (res.code === 0) {
						var product = [];
						res.data.forEach(item => {
							if (item.goodsPrice !== "") {
								product.push(item);
							}
						});
						this.floorList[this.navIndex].floorGoodsList[this.floorList[this.navIndex].curIndex].productData = product;
					}
				})
			},
			toast(msg) {
				uni.showToast({
					title: msg,
					duration: 1200,
					mask: false,
					icon: 'none'
				});
			},
			// 点击楼层商品跳转到详情页
			navToFloorItemDetail(good) {
				const id = good.goodsId;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			},
			// 点击更多品目
			navToMore(item, index) {

			},
			//轮播图切换修改背景色
			swiperChange(e) {
				const index = e.detail.current;
				this.swiperCurrent = index;
			},
			//详情页
			navToDetailPage(item) {
				let id = item.goodsId;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			},
			toSearch() {
				if (this.searchKey !== '') {
					let key = this.searchKey
					this.searchKey = ''
					uni.navigateTo({
						url: `/pages/product/list?key=${key}`
					})
				}
			},
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
		},
		// #ifndef MP
		// 标题栏input搜索框点击
		onNavigationBarSearchInputClicked: async function(e) {
			this.$api.msg('点击了搜索框');
		},
		//点击导航栏 buttons 时触发
		onNavigationBarButtonTap(e) {
			const index = e.index;
			if (index === 0) {
				this.$api.msg('点击了扫描');
			} else if (index === 1) {
				// #ifdef APP-PLUS
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];
				const currentWebview = page.$getAppWebview();
				currentWebview.hideTitleNViewButtonRedDot({
					index
				});
				// #endif
				uni.navigateTo({
					url: '/pages/notice/notice'
				})
			}
		}
		// #endif
	}
</script>

<style lang="scss">
	.tag {
	  align-items: center;
	  padding: 6upx 10upx;
	  border: 1rpx solid #DF3325;
	  font-size: $font-sm;
	  color: #DF3325;
	  border-radius: 6upx;
	  line-height: 1;
	  margin:5rpx 5rpx 5rpx 0
	}
	.drag-button{
	    background: #FFFFFF;
	    border: 0.5px solid #EEEEEE;
	    box-shadow: 0 5rpx 10rpx 0 rgba(0,0,0,0.08);
	    width: 100rpx;
	    height: 100rpx;
	    font-size: 24rpx;
	    color: #000000;
	    position: fixed;
	    right: 40rpx;
	    top: 900rpx;
	    border-radius: 100%;
	    display: flex;
	    align-items: center;
	    justify-content: center;
			image {
				width: 50%;
				height: 50%;
			}
	}
	.huanhang{
		word-break: break-all;/*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/
		text-overflow: ellipsis;
		display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
		-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
		-webkit-line-clamp: 2; /** 显示的行数 **/
		overflow: hidden;  /** 隐藏超出的内容 **/
	}
	.addressIcon{
		left: 19px;
		top: 50px;
		width: 24px;
		height: 24px;
		border-radius: 0px 0px 0px 0px;
		background-color: rgba(16, 130, 242, 100);
	}
	%flex-center {
		display: flex ;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	%section {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10upx;
	}

	.empty-container {
		text-align: center;
		width: 100% ;
		padding-top: 40px;
	}

	.head-section {
		background-image: linear-gradient(to bottom , #00B48D 100%,#00B48D 0%);
		background-image: linear-gradient(180deg, #00B48D 0%, rgba(0,180,141,0.00) 100%);
		// margin-top: 20rpx;
		height: 400upx;
		position: relative;
		// margin-bottom: 30px;

		.bg {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
		}
	}

	.mp-search-box {
		position: sticky;
		left: 0;
		top: 0;
		z-index: 9999;
		width: 100%;
		height: 100rpx;
		// padding: 20rpx 30rpx;
		text-align: center;
		display: flex;
		flex-direction: column;
		// background-color:rgba($color: #F7F7F7 , $alpha: 0.8) ;
		// background-image: linear-gradient(to bottom , #00B48D ,rgba(0,180,141,0));
		background-color: #00B48D;
		// .searchBox{
		// 	display: flex;
		// 	align-items: center;
		// 	padding: 10rpx;
		// 	justify-content: space-around;
		// 	// margin-top: 90rpx;
		// 	background-color:#E8E8EB ;
		// 	.inputBox{
		// 		display: flex;
		// 		background: #fff;
		// 		height: 68rpx;
		// 		width: 98%;
		// 		border-radius: 5px;
		// 		&::before {
		// 			content: " ";
		// 			display: inline-block;
		// 			width: 33rpx;
		// 			height: 33rpx;
		// 			position: relative;
		// 			top: 18rpx;
		// 			left: 305rpx;
		// 			background: url(../../static/search-icon.png) no-repeat;
		// 			background-size: contain;
		// 		}
		// 	}


		// }
		.search-input {
			width: 550rpx;
			height: 60rpx;
			background: $my-bg-color-grey;
			border-radius: 30rpx;
			width: 80%;
			font-size: $my-font-size-base;
			// background-color:rgba($color: #F7F7F7 , $alpha: 0.8) ;
			opacity: 0.6;
			background: #FFFFFF;
			&::before {
				content: " ";
				display: inline-block;
				width: 33rpx;
				height: 33rpx;
				position: relative;
				top: 14rpx;
				left: -260rpx;
				// background: url(../../static/search-icon.png) no-repeat;
				background-size: contain;
			}
			input::-webkit-input-placeholder{
            color:red;
        }
			input {

				position: relative;
				top: -30rpx;
				// left: -66rpx;
				// color: $my-text-color-base;
				font-size: $my-font-size-base;
				color: #FFFFFF!important;
				// color: white !important;


			}
		}

		.addressBox{
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 10rpx;
			height: 80rpx;
			width: 100%;
			// background: #f0f0f0 ;
			// background-color:rgba($color: #D3D3D3, $alpha: 0.6) ;
			z-index: 9999;
			.iconTableL{
				margin-left: 15rpx;
				// margin-top: 10rpx;
				// margin: 10rpx;
			}
			.iconTableR{
				margin-right: 15rpx;
				// margin-top: 10rpx;
				// margin: 10rpx;
			}
			.topText{
				font-family: PingFangSC-Regular;
				font-size: 18rpx;
				line-height: 18rpx;
				color: #EEEEEE;
				// line-height: 18rpx;
			}

		}

		.ser-input {
			width: 100%;
			height: 70rpx;
			line-height: 60rpx;
			text-align: center;
			font-size: 28upx;
			color: #909090;
			border-radius: 5px;
			// background: #f0f0f0;
			// background: #fff;
		}

		.search {
			width: 40rpx;
			height: 40rpx;
			margin-top: 10rpx;
		}

		.ph {
			text-align: center;
			font-size: 28upx;
			color: $font-color-base;
		}
	}

	page,
	.container {
		background: #f5f5f5;
	}
	.navigation{
		width: 100%;
		height: 90rpx;
		background-color: $my-bg-color-grey;
		// top: var(--status-bar-height);
		// position: absolute;
		 // position: -webkit-sticky;
			//   position: sticky;
			//   top: 80rpx;
			//   z-index: 99;
		.navigationContent{
			display: flex;
			align-items: center;
			justify-content: space-around;
		}

	}
	.m-t {
		margin-top: 16upx;
	}

	.m-p {
		padding: 0 30upx;
	}

	.hot-c {
		// width: 100%;
		height: 396rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin: 0 30rpx 16rpx 30rpx;
		// padding: 16rpx 0;
		padding-top: 26rpx;
		padding-bottom: 10rpx;

		.hot-swiper {
			width: 100%;
			height: 100%;

			.hot-swiper-list {
				width: 100%;
				height: 100%;
				padding: 0 28rpx;
				overflow: hidden;
				display: flex;
				flex-wrap: wrap;
				align-items: center|flex-start;
			}

			.hot-swiper-item {
				height: 180rpx;
				width: 25%;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;

				.catalog-name {
					text-align: center;
					height: 70rpx;
					font-size: 24rpx;
				}

				image {
					width: 100rpx;
					height: 100rpx;
					// border-radius: 50%;
					margin-bottom: 10rpx;
				}

				text {
					font-size: 24rpx;
				}
			}

		}
	}

	/* 头部 轮播图 */
	.carousel-section {
		position: absolute;
		// background-color: #fff;
		// padding-top: 95rpx;
		left: 0;
		width: 100%;
		top: 100rpx;

		// .titleNview-placing {
		// 	height: var(--status-bar-height);
		// 	padding-top: 44px;
		// 	box-sizing: content-box;
		// }

		// .titleNview-background {
		// 	position: absolute;
		// 	top: 0;
		// 	left: 0;
		// 	width: 100%;
		// 	height: 426upx;
		// 	transition: .4s;
		// }
	}

	.w-carousel {
		// position: absolute;
		// bottom: 20rpx;
		// right: 50rpx;
		// left: 50rpx;
		display: block;
		// border: 0;
		// margin: 0;
		background-color: #F7B500;
		padding: 20rpx;
		border-radius: 0 0 10rpx 10rpx;

		.w-carousel-item {
			width: 100%;
			height: 250rpx;
			overflow: hidden;
		}

		image {
			width: 100%;
			height: 100%;
			border-radius: 10upx;
		}
	}

	.carousel {
		width: 100%;
		height: 350upx;

		.carousel-item {
			width: 100%;
			height: 100%;
			padding: 0 28upx;
			overflow: hidden;
			image {
				width: 100%;
				height: 100%;
			}
		}

		image {
			width: 100%;
			height: 100%;
			border-radius: 10upx;
		}
	}

	.swiper-dots {
		display: flex;
		position: absolute;
		left: 60upx;
		bottom: 30upx;
		width: 72upx;
		height: 36upx;
		background-image: url();
		background-size: 100% 100%;

		.num {
			width: 36upx;
			height: 36upx;
			border-radius: 50px;
			font-size: 24upx;
			color: #fff;
			text-align: center;
			line-height: 36upx;
		}

		.sign {
			position: absolute;
			top: 0;
			left: 50%;
			line-height: 36upx;
			font-size: 12upx;
			color: #fff;
			transform: translateX(-50%);
		}
	}

	/* 分类 */
	.cate-section {
		display: flex;
		justify-content: space-around;
		align-items: center;
		flex-wrap: wrap;
		padding: 30upx 22upx;
		background: #fff;

		.cate-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;
		}

		/* 原图标颜色太深,不想改图了,所以加了透明度 */
		image {
			width: 88upx;
			height: 88upx;
			margin-bottom: 14upx;
			border-radius: 50%;
			opacity: .7;
			box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
		}
	}

	.ad-1 {
		width: 100%;
		height: 210upx;
		padding: 10upx 0;
		background: #fff;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.welfare-section {
		margin: 0 30rpx 16rpx 30rpx;
		// border-radius: 10rpx;
		margin-bottom: 16rpx;
		// height: 500px;
		// padding: 4upx 30upx 24upx;
		// background-color: #fff;

		.w-bg {
			display: block;
			// border: 0;
			// margin: 0;
			// padding: 0;
			position: relative;
			width: 100%;
		}
	}

	/* 秒杀专区 */
	.seckill-section {
		// margin-bottom: 16rpx;
		margin: 0 30rpx 16rpx 30rpx;
		padding: 4upx 30upx 24upx;
		border-radius: 10rpx;
		background: #fff;
		.order-hotTitle {
			display: flex;
			justify-content: space-between !important;
			align-items: center;
			// margin-top: 15rpx;
			width: 100%;
			.hot-title{
				margin-top: 20rpx;
			}
		}
		.hot-title-image{
			margin-left: 10rpx;
			width: 28rpx;
			height: 28rpx;
			background-image: url(../../static/newh5/Arrow-Right.png);
			background-size: contain;
			background-repeat: no-repeat;
		}
		.s-header {
			display: flex;
			align-items: center;
			height: 92upx;
			line-height: 1;

			.s-img {
				width: 140upx;
				height: 30upx;
			}

			.tip {
				font-size: $font-base;
				color: $font-color-light;
				margin: 0 20upx 0 40upx;
			}

			.timer {
				display: inline-block;
				width: 40upx;
				height: 36upx;
				text-align: center;
				line-height: 36upx;
				margin-right: 14upx;
				font-size: $font-sm+2upx;
				color: #fff;
				border-radius: 2px;
				background: rgba(0, 0, 0, .8);
			}

			.icon-you {
				font-size: $font-lg;
				color: $font-color-light;
				flex: 1;
				text-align: right;
			}
		}

		.hot-list {
			white-space: nowrap;
		}

		.scoll-wrapper {
			display: flex;
			// flex-flow: row wrap;
			// justify-content: space-between;
		}
		.goodPriceBox{
			margin-top: 10rpx;
			display: flex;
			justify-content: space-between;
			background-image: linear-gradient(to right ,#FD8D3C ,#F5212D );
			// color: white;
			// border-radius: 12px;
			border-top-left-radius: 12px;
			border-bottom-left-radius: 12px;
			.priceBox{
				flex: 1;
				font-family: PingFangSC-Medium;
				// background-image: linear-gradient(to right ,#FD8D3C ,#F5212D );
				.price{
					color: white;
					font-size: $my-font-size-middle;
				}
			}
			.buyBox{
				font-family: PingFangSC-Medium;
				width: 40rpx;
				background-image: linear-gradient(to right ,#FD8D3C ,#F5212D );
				// background: linear-gradient(-60deg, transparent 15px, #FD8D3C 0);
			}
		}
		.hot-item {
			width: 180upx;
			// width: 30%;
			margin-right: 20upx;
			font-size: $font-sm+2upx;
			color: $font-color-dark;
			// line-height: 1.8;
			text-align: center;
			display: flex;
			flex-direction: column;
			image {
				width: 180upx;
				height: 180upx;
				border-radius: 6upx;
			}

			.item-title{
				line-height: 30rpx;
				height: 60rpx;
				text-align: left;
				color: $font-color-dark;
				font-size: $my-font-size-base;
				margin-top: 10rpx;
				white-space: normal
			}

			.integral {
				width: 160rpx;
				color: $uni-color-primary;
				font-size: 15px;
				margin: 4rpx 4rpx 0 4rpx;

				&:before {
					background: url(../../static/money.png) no-repeat;
					width: 22rpx;
					height: 22rpx;
					margin-right: 4rpx;
					display: inline-block;
					content: '';
					background-size: contain;
				}

				&:after {
					margin-left: 4rpx;
					content: '积分';
					color: #909090;
					font-size: 12px;
				}
			}

			.price {
				// width: 160rpx;
				color: $uni-color-primary;
				font-size: 15px;
				color: white;
			}
			.cartIcon{
				width: 50rpx;
				height: 50rpx;
				// margin-top: 15rpx;
			}
		}
	}

	.f-header {
		display: flex;
		align-items: center;
		height: 100upx;
		background: #fff;

		image {
			flex-shrink: 0;
			width: 50upx;
			height: 50upx;
			margin-right: 15upx;
		}

		.tit-box {
			flex: 1;
			display: flex;
			flex-direction: column;
		}

		.tit {
			font-size: 17px;
			color: #font-color-dark;
			line-height: 1.3;
		}

		.tit2 {
			font-size: $font-sm;
			color: $font-color-light;
		}

		.icon-you {
			font-size: $font-lg +2upx;
			color: $font-color-light;
		}
	}

	/* 团购楼层 */
	.group-section {
		background: #fff;

		.g-swiper {
			height: 650upx;
			padding-bottom: 30upx;
		}

		.g-swiper-item {
			width: 100%;
			padding: 0 30upx;
			display: flex;
		}

		image {
			width: 100%;
			height: 460upx;
			border-radius: 4px;
		}

		.g-item {
			display: flex;
			flex-direction: column;
			overflow: hidden;
		}

		.left {
			flex: 1.2;
			margin-right: 24upx;

			.t-box {
				padding-top: 20upx;
			}
		}

		.right {
			flex: 0.8;
			flex-direction: column-reverse;

			.t-box {
				padding-bottom: 20upx;
			}
		}

		.t-box {
			height: 160upx;
			font-size: $font-base+2upx;
			color: $font-color-dark;
			line-height: 1.6;
		}

		.price {
			color: $uni-color-primary;
		}

		.m-price {
			font-size: $font-sm+2upx;
			text-decoration: line-through;
			color: $font-color-light;
			margin-left: 8upx;
		}

		.pro-box {
			display: flex;
			align-items: center;
			margin-top: 10upx;
			font-size: $font-sm;
			color: $font-base;
			padding-right: 10upx;
		}

		.progress-box {
			flex: 1;
			border-radius: 10px;
			overflow: hidden;
			margin-right: 8upx;
		}
	}

	.floor-section {
		margin: 20rpx 30rpx 0 30rpx;

		.floor-content {
			display: flex;
			flex-direction: column;

			.nav {
				overflow-x: auto;
				white-space: nowrap;
				display: flex;
				// align-items: center;
				padding-left: 13px;
				flex-direction: row;
				align-items: center;
				padding-bottom: 20rpx;

				.nav-item {
					// font-size: 17px;
					padding-top: 10px;
					color: $font-color-dark;
					// margin-bottom: 8rpx;
					margin-right: 20px;
					// border-bottom: 5rpx solid #f5f5f5;
					font-family: PingFangSC-Medium;
					font-size: 13px;
					letter-spacing: 0;
					line-height: 20px;
					&.current {
						color: #00B48D;
						// background-image: -webkit-linear-gradient(left, #FFA241, #FF7948, #FF514E);
						// -webkit-mask-image: -webkit-gradient(linear, 0 0, left, from(#FFA241), to(#FF514E));
						// -webkit-background-clip: text;
						// -webkit-text-fill-color: transparent;
						// font-weight: bold;
						margin-right: 20px;

						border-bottom: 5rpx solid #00B48D;
						// border-image: -webkit-linear-gradient(left, #FFA241, #FF7948, #FF514E)1 10 1;
						// /* 控制边框颜色渐变 */
						// border-image: -moz-linear-gradient(left, #FFA241, #FF7948, #FF514E)1 10 1;
						// border-image: linear-gradient(left, #FFA241, #FF7948, #FF514E)1 10 1;

						// &::after {
						// 	content: '';
						// 	width: 40%;
						// 	height: 1px;
						// 	display: block;
						// 	margin: 0 auto;
						// 	border-bottom: 2.5px solid;
						// 	border-image: -webkit-linear-gradient(left, #FFA241, #FF7948, #FF514E)1 10 1;
						// 	/* 控制边框颜色渐变 */
						// 	border-image: -moz-linear-gradient(left, #FFA241, #FF7948, #FF514E)1 10 1;
						// 	border-image: linear-gradient(left, #FFA241, #FF7948, #FF514E)1 10 1;
						// }
					}
				}
			}
			.tab {
				padding-bottom: 20rpx;
				padding-top: 5px;
				padding-left: 13px;
				display: flex;
				flex-direction: row;
				align-items: center;
				overflow-x: auto;
				white-space: nowrap;
				font-family: PingFangSC-Medium;

				.tab-item {
					font-size: 13px;
					color: $font-color-dark;
					border-radius: 16px;
					padding: 4rpx 14rpx;
					background: none;
					margin-right: 10px;
					background: #F5F5F5;
					color: #646464;
					font-size: 12px;
					font-family: PingFangSC-Regular;
					&.current {
						background: #F5F5F5 ;
						color: #3fc7a8;
						border-radius: 20px;
						padding: 4rpx 16rpx;
					}
				}
			}
			.item-area {
				display: flex;
				margin-top: 10rpx;
				flex-direction: column;



				.item-wrapper {
					display: flex;
					justify-content: space-between;
					flex-flow: row wrap;

					.floor-item {
						width: 48%;
						background-color: #fff;
						border-radius: 10rpx;
						padding: 16rpx;
						font-size: 15px;
						color: $font-color-dark;
						// line-height: 1.8;
						text-align: center;
						margin-bottom: 20rpx;

						// padding-bottom: 30rpx;
						.item-title {
							height: 40px;
							text-align: left;
							color: $font-color-dark;
							font-size: 15px;
							margin-bottom: 8rpx;
							// overflow: hidden;
							// text-overflow: ellipsis;
						}

						image {
							width: 100%;
							height: 150px;
							border-radius: 6upx;
						}

						.bottom {
							display: flex;
							justify-content: space-between;
							align-items: center;

							.left {
								display: flex;
								flex-direction: column;

								.integral {
									color: $uni-color-primary;
									font-size: 17px;
									// margin: 4rpx 4rpx 0 4rpx;

									&:before {
										background: url(../../static/money.png) no-repeat;
										width: 24rpx;
										height: 24rpx;
										margin-right: 4rpx;
										display: inline-block;
										content: '';
										background-size: contain;
									}

									&:after {
										margin-left: 4rpx;
										content: '积分';
										color: #909090;
										font-size: 12px;
									}
								}

								.price {
									width: 160rpx;
									color: $uni-color-primary;
									font-size: 15px;

									margin: 4rpx 4rpx 0 4rpx;
								}
							}

							.right {
								display: flex;
								align-items: center;

								image {
									width: 80rpx;
									height: 80rpx;
								}
							}
						}
					}
				}
			}


			.floor-item {}
		}
	}

	/* 分类推荐楼层 */
	.hot-floor {
		background: #fff;
		margin: 0 30rpx 16rpx 30rpx;
		padding: 0 13rpx 20rpx 13px;
		// margin: 0 30rpx 16rpx 30rpx;
		border-radius: 10rpx;
		// margin-bottom: 16rpx;

		.floor-content {
			width: 100%;
			display: flex;
			flex-direction: column;

			.floor-header {
				width: 100%;
				height: 100rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.title {
					text-align: center;
					font-size: 16px;

					image {
						width: 50upx;
						height: 50upx;
						vertical-align: middle;
						margin-right: 20upx;
					}

					.blue-font {
						color: #font-color-dark;
						line-height: 1.3;
						display: inline-block;
					}
				}

				.navbar {
					height: 100rpx;
					text-align: center;
					float: right;
					background: #fff;
					display: flex;
					align-items: center;

					.nav-item {
						display: inline-block;
						margin-left: 8upx;
						font-size: 14px;
						color: $font-color-dark;

						&.current {
							color: $base-color;
						}
					}
				}

				.border-font {
					display: inline-block;
					font-size: 16px;
					color: #909090;
					border-bottom: 1px solid #4399FC;
					vertical-align: middle;
				}

				.more {
					display: inline-block;
					font-size: 14px;
					color: $font-color-dark;
					vertical-align: middle;
				}
			}

			.item-wrapper {
				display: flex;
				justify-content: space-between;
				flex-flow: row wrap;

				.floor-item {
					width: 48%;
					font-size: 15px;
					color: $font-color-dark;
					line-height: 1.8;
					text-align: center;

					// padding-bottom: 30rpx;
					.item-title {
						height: 55px;
						text-align: left;
						color: $font-color-dark;
						font-size: 15px;
						// overflow: hidden;
						// text-overflow: ellipsis;
					}

					image {
						width: 100%;
						height: 150px;
						border-radius: 6upx;
					}

					.bottom {
						display: flex;
						justify-content: space-between;

						.left {

							.integral {
								color: $uni-color-primary;
								font-size: 17px;
								// margin: 4rpx 4rpx 0 4rpx;

								&:before {
									background: url(../../static/money.png) no-repeat;
									width: 24rpx;
									height: 24rpx;
									margin-right: 4rpx;
									display: inline-block;
									content: '';
									background-size: contain;
								}

								&:after {
									margin-left: 4rpx;
									content: '积分';
									color: #909090;
									font-size: 12px;
								}
							}

							.price {
								width: 160rpx;
								color: $uni-color-primary;
								font-size: 15px;
								margin: 4rpx 4rpx 0 4rpx;
							}
						}

						.right {
							display: flex;
							align-items: center;

							image {
								width: 80rpx;
								height: 80rpx;
							}
						}
					}
				}
			}
		}
		.backIcon{
				position: fixed;
				display: flex;
				flex-direction: row-reverse;
				z-index: 999;
				bottom: 50px;
				width: 90%;
				height: 70rpx;
				.cycle{
							border-radius: 40%;
							width: 25px;
							height: 25px;
							background-color:#f8f8f8;
							display: flex;
							justify-content: center;
							align-items: center;
			}
			}
		.floor-list {
			white-space: nowrap;
			padding: 20upx;
			padding-right: 50upx;
			border-radius: 6upx;
			margin-top: -140upx;
			margin-left: 30upx;
			background: #fff;
			box-shadow: 1px 1px 5px rgba(0, 0, 0, .2);
			position: relative;
			z-index: 1;
		}

		.scoll-wrapper {
			display: flex;
			flex: row wrap;
			align-items: flex-start;

			.item-title {
				height: 55px;
				text-align: left;
				color: $font-color-dark;
				font-size: 15px;
				// overflow: hidden;
				// text-overflow: ellipsis;
			}
			.more-t {
				overflow: hidden; // 超出的文本隐藏
				word-break: break-all;
				text-overflow: ellipsis; // 溢出用省略号显示
				display: -webkit-box; // 将对象作为弹性伸缩盒子模型显示。
				-webkit-line-clamp: 2; // 这个属性不是css的规范属性，需要组合上面两个属性，表示显示的行数。
				-webkit-box-orient: vertical; // 从上到下垂直排列子元素（设置伸缩盒子的子元素排列方式）
				transition: all linear 0.2s;
			}


		}

		// .floor-item {
		// 	width: 180upx;
		// 	margin-right: 20upx;
		// 	font-size: $font-sm+2upx;
		// 	color: $font-color-dark;
		// 	line-height: 1.8;

		// 	image {
		// 		width: 180upx;
		// 		height: 180upx;
		// 		border-radius: 6upx;
		// 	}

		// 	.price {
		// 		color: $uni-color-primary;
		// 	}
		// }

		// .more {
		// 	display: flex;
		// 	align-items: center;
		// 	justify-content: center;
		// 	flex-direction: column;
		// 	flex-shrink: 0;
		// 	width: 180upx;
		// 	height: 180upx;
		// 	border-radius: 6upx;
		// 	background: #f3f3f3;
		// 	font-size: $font-base;
		// 	color: $font-color-light;

		// 	text:first-child {
		// 		margin-bottom: 4upx;
		// 	}
		// }
	}

	/* 猜你喜欢 */
	.guess-section {
		display: flex;
		flex-wrap: wrap;
		padding: 0 30upx;
		background: #fff;

		.guess-item {
			display: flex;
			flex-direction: column;
			width: 48%;
			padding-bottom: 40upx;

			&:nth-child(2n+1) {
				margin-right: 4%;
			}
		}

		.image-wrapper {
			width: 100%;
			height: 330upx;
			border-radius: 3px;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
				opacity: 1;
			}
		}

		.title {
			font-size: $font-lg;
			color: $font-color-dark;
			line-height: 80upx;
		}

		.price {
			font-size: $font-lg;
			color: $uni-color-primary;
			line-height: 1;
		}
	}

	.articles {
		display: flex;
		align-items: center;
		background-color: $my-bg-color;
		height: 60rpx;
		margin: 30rpx;
		margin-top: 0;
		border-radius: 10rpx;
		padding: 0 16rpx;
		color: #2B2B2B;
		font-size: $my-font-size-sm;

		image {
			width: 30rpx;
			height: 30rpx;
		}

		.article-swiper {
			margin: 0 16rpx;
			flex: 1;
			height: 60rpx;

			.article-swiper-item {
				width: 100%;
				height: 60rpx;
				line-height: 60rpx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				word-break: break-all;
			}
		}

		.split {
			width: 2rpx;
			height: 25rpx;
			background-color: #2B2B2B;
			margin-right: 20rpx;
		}
	}
	.hot-supplier {
		font-size: 26rpx;

		margin: 20rpx 30rpx;
		border-radius: 20upx;
		padding: 20upx 20upx;
		border: 2rpx solid rgb(242, 242, 242);
		background-color: #fff;
		&.show {
			display: block;
		}
		.hot-supplier_header{
			display: flex;
			justify-content: space-between;
			font-size: 30rpx;
			padding: 5upx;
			margin-bottom: 10upx;
		}
		&_header {
			color: #333;
		}

		&_wrapper {
			display: flex;
			align-items: flex-start;
		}

		&_item {
			margin-right: 20rpx;
			margin-top: 10rpx;

			&:last-child {
				margin-right: 0;
			}

			&_img {
				width: 160rpx;
				height: 160rpx;
				position: relative;
				border-radius: 10rpx;
	background-color: #EBEEF5;
				image {
					width: 100%;
					height: 100%;
					border: 2rpx solid #e2e2e2;
					border-radius: 10rpx;
					position: absolute;
					    top: 0;
					    bottom: 0;
					    left: 0;
					    right: 0;
					    margin: auto;
				}


				&_tag {
					position: absolute;
					right: 4rpx;
					top: 4rpx;
					font-size: 20rpx;
					background: white;
					border: 2rpx solid #333;
					border-radius: 20rpx;
					transform: scale(0.7);
					transform-origin: right top;
					padding: 4rpx 10rpx;
				}
			}
				&_content {
					width: 160upx;
					overflow: hidden; //超出的文本隐藏
					display: -webkit-box;
					-webkit-line-clamp: 2; // 超出多少行
					-webkit-box-orient: vertical;
					// &_add{
					// 	width: 60rpx;
					// }
				}
		}
	}
	.hotNew-seciton{
		margin: 20rpx 30rpx 0;
		display: flex;
		justify-content: space-between;
		.hotNew_item{
			width: calc(50% - 16rpx);
			border-bottom: 24rpx;
			position: relative;
			image{
				width: 100%;
			}
			&_text{
				position: absolute;
				top: 30rpx;
				left: 40rpx;
				z-index: 1;
				color: #909090;
				font-size: 24rpx;
				&_h{
					font-size: 32rpx;
					font-weight: 600;
					margin-bottom: 6rpx;
					color: #303133;
				}
			}
		}
	}
	.advertise-carousel{
		height: 210rpx;
		margin: 20rpx 30rpx 0;
		image{
			width: 100%;
			border-radius: 10rpx;
			height: 210rpx;
		}
	}
	.home-banner{
		position: relative;
		height: 0;
		transition: height 0.5s;

		&.show{
			height: 100vh;
		}
		image{
			width:100vw;
			height:100%;
			overflow: hidden;
		}
		.home-banner-btn{
			position: absolute;
			border-radius: 40rpx;
			padding: 10rpx 40rpx;
			border: 2rpx solid #fff;
			background-color: rgba(#000,0.3);
			color: white;
			font-size: 26rpx;
			&.skip{
				top: 20rpx;
				right: 20rpx;
			}

			&.detail{
				width: fit-content;
				bottom: 20rpx;
				margin: auto;
				left: 0;
				right: 0;
				padding: 20rpx 100rpx;
				font-size: 30rpx;
			}

			&:active{
				background-color: rgba(#000,0.4);
			}
		}
	}
	.home-notice{
		max-height:70vh;
		width: 100%;
		padding: 20rpx;
		overflow-y: auto;
		.home-notice-title{
			text-align: center;
			font-size: 26rpx;
		}
		.home-notice-content{
			word-break: break-all;
			width: 100%;
		}
	}
</style>

